package com.lagou.edu.servlet;

import com.lagou.edu.anno.Autowired;
import com.lagou.edu.anno.Service;
import com.lagou.edu.dao.impl.JdbcAccountDaoImpl;
import com.lagou.edu.factory.BeanFactory;
import com.lagou.edu.factory.ProxyFactory;
import com.lagou.edu.service.TransferService;
import org.junit.Test;
import org.reflections.Reflections;

import javax.swing.undo.AbstractUndoableEdit;
import java.lang.reflect.Field;
import java.util.Set;

public class TestC {
    @Test
    public void test() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
//        Class<?> aClass = Class.forName("com.lagou.edu.dao.impl.JdbcAccountDaoImpl");
//        Object o = aClass.newInstance();
//        System.out.println("123");
//        System.out.println("123");
        Object proxyFactory = BeanFactory.getBean("proxyFactory");
//        Reflections f = new Reflections("com.lagou.edu");
//        Set<Class<?>> set = f.getTypesAnnotatedWith(Service.class);
//        for (Class<?> c : set) {
//            Object bean = c.newInstance();
//            Service annotation = c.getAnnotation(Service.class);
//            Field[] declaredField = bean.getClass().getDeclaredFields();
//            for (Field field : declaredField) {
//                Autowired annotation1 = field.getAnnotation(Autowired.class);
//                System.out.println("123");
//            }
//
//            System.out.println("123");
//        }
        System.out.println("123");
    }

    @Test
    public void test1(){
        JdbcAccountDaoImpl jdbcAccountDao = new JdbcAccountDaoImpl();
        ProxyFactory proxyFactory = new ProxyFactory();
        Class<?>[] interfaces = proxyFactory.getClass().getInterfaces();
        System.out.println(interfaces.length);
    }
}
